<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="调拨单审核" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<script src="/js/popup_ext.js"></script>
<script src="/js/QueryList.js"></script>
<script language="javascript">
	function doShow(id){
		var url="/storehouse/AlloBillInfoForExamine.ihtm?id="+id;
		ShowIframe("调拨单审核",url,900,500,"refreshWin()",900,600);
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location=window.location;
		}
	}
	function doExamineCallBack(id){
		if(popRetVal!=null){
			var url="/storehouse/AlloBillExamine.ihtm?id_str="+id+"&flag=1";
			ShowIframe("调拨单审核",url,200,200,"refreshWin()");
		}
	}
	function doExamine(id){
		ShowConfirm('确认框','确定审核通过吗？',340,80,"doExamineCallBack('"+id+"')");
	}
	function doMutiExamine(){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		for (i=0;i<ob_arr.length;i++){
			if ((ob_arr[i].checked == true)){
				if(str!=""){
					str=str+";";
				}
				str = str+ob_arr[i].value;
			}
		}
		if(str!=""){
			doExamine(str);
		}else{
			ShowAlert('提示框','请选择要审核的单据',200,100);
		}
	}
	function doSearch(){
		var searchKey=encodeURIComponent(document.getElementById("search_key").value);
		var tsId=document.getElementById("ts_id").value;
		window.location="/storehouse/AlloBillListForExamine.ihtm?ts_id="+tsId+"&search_key="+searchKey;
	}
	function doGo(pageIndex){
		var searchKey=encodeURIComponent("${searchKey}");
		window.location="/storehouse/AlloBillListForExamine.ihtm?ts_id=${tsId}&search_key="+searchKey+"&current_page="+pageIndex;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		if(ob_arr.length>=it.getAttribute("index")){
			str=ob_arr[it.getAttribute("index")-1].value;
		}
		if(str==""){
			return;
		}
		doShow(str);
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		//Window_Onload();
		document.getElementById("search_key").focus();
	}
	function checkSearchKey(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
</script>
</head>
<body oncontextmenu="return false" onLoad="doInit();" class="sheet" style="text-align:center">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>调拨单审核</h2>
      <p>在这里可以对所有未审核的调拨单进行审核操作</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
      <div class="content">
        <table width="100%">
          <tbody>
            <tr>
              	<td >
	              	<div align="right">
						<input type="text" class="TextBox" id="search_key" name="search_key" onKeyUp="checkSearchKey();" value="${searchKey}">
						<select name='ts_id' id="ts_id">
							<option value="0">==请选择账套==</option>
							<c:forEach var="item" items="${tsList}">
							<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option>
							</c:forEach>
				  		</select>
						<input type="button"  value="查 询" onClick="doSearch();"  class="buttom search-but"> 
						<input type="button" class="buttom  search-audit" value=" 审 核" onClick="doMutiExamine();">       
					</div>
				</td>
            </tr>    
            </tbody>      
        </table>      	 
      </div>
	  <%@include file="../inc/AlertMsg.jsp"%>
	  <div class="table-list">
        <table width="100%">
          	<tr>   
				<th width="14"><input type="checkbox" onClick="javascript:checkall(this);"></th>
				<th width="15%">单号</th>
				<th width="10%">调拨日期</th>
				<th width="10%">调出仓库</th>
				<th width="10%">调入仓库</th>
				<th width="35%">摘要</th>
				<th width="10%">经办人</th>
				<th width="10%">操作</th>	
			</tr>
			<c:forEach var="item" items="${qr.list}" varStatus="i">
				<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
				<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
				<tr class="${trClass}" index="${i.index+1}" style='cursor:pointer;' ondblclick='javascript:DoubleClick(this)' onClick='javascript:ClickCheck(this,true)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
					<td><input type="checkbox" onClick="javascript:ClickCheck(this,true);" id="query_checkbox" name='query_checkbox' value="${item.id}"></td>
					<td>${item.billCode}</td>
					<td><fmt:formatDate value="${item.alloDate}" pattern="yyyy-MM-dd"/></td>
					<td><commonTag:showSimpleObjectName list="${stoList}" objectId="${item.fromStoId}" /></td>
					<td><commonTag:showSimpleObjectName list="${stoList}" objectId="${item.toStoId}" /></td>
					<td>${item.description}</td>
					<td>${item.managerName}</td>
					<td>
						<a href="javascript:doExamine('${item.id}');">审核通过</a>
						<a href="javascript:doShow('${item.id}');">查看</a>
					</td>
				</tr>
			</c:forEach>
		</table>
		<%@include file="../inc/Pages.jsp"%>
      </div>     
    </div>
  </div>
</div>
</body>
</html>
